<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="shortcut icon" href="__STATIC__/logo.ico" />
    <link rel="stylesheet" href="__STATIC__/assets/arr_css/bootstrap.min.css">
    <link rel="stylesheet" href="__STATIC__/assets/index_css/head.css">
    <link rel="stylesheet" href="__STATIC__/assets/index_css/footer.css">
    <link rel="stylesheet" href="__STATIC__/assets/ferr/loan.css">
    <link href="__STATIC__/layer/layui.css" rel="stylesheet" type="text/css" />
    <title>免息借款</title>
    <style>
        .layui-form-radio {
            margin: 0px 10px 0 0;
            color: #777777;
        }
    </style>
</head>

<body>
    {include file="public/top"}
    <div class="top_img" style="z-index:-999;">
        <img src="__STATIC__/assets/images/loan_top.png" alt="" style="width:100%;">
    </div>
    <div class="cooperative_bank" style="width: 1200px;margin: 0 auto;">
        <div class="bank_logo ">
            <img src="__STATIC__/assets/images/icon_1.png" alt="">
            <img src="__STATIC__/assets/images/icon_2.png" alt="">
            <img src="__STATIC__/assets/images/icon_3.png" alt="">
        </div>
        <div class="bank_xinxi">

            <div>
                <img src="__STATIC__/assets/images/bank_zheshang.png" alt="">
            </div>
            <div>
                <img src="__STATIC__/assets/images/bank_minsheng.png" alt="">
            </div>
        </div>






        <form class="bank_form layui-form" id="formdata">
            <div class="bank_box layui-form-item ">
                <div class=" bank_text layui-input-block ">
                    <span style=" width: 90px;">申请人：</span>
                    <input type="text" name="uname" lay-verify="required" autocomplete="off" placeholder="请填写您的姓名" class="layui-input" id="name">
                </div>
                <div class=" bank_text layui-input-block ">
                    <span>联系方式：</span>
                    <input type="tel" name="phone" lay-verify="required|phone" autocomplete="off" class="layui-input" placeholder="请填写您的手机号码"
                        id="phone">
                </div>

                <div class=" bank_text layui-input-block ">
                    <span>所在城市：</span>
                    <input type="text" name="address" lay-verify="required" autocomplete="off" placeholder="请填写您的所在城市" class="layui-input">
                </div>
                <!-- <div class="bank_text layui-input-block">
                    <select id="bank_name" name="interest" lay-filter="aihao" lay-verify="required">
                        <option value="0">请填写您需要申请贷款的银行</option>
                        <option value="华夏银行">华夏银行</option>
                        <option value="民生银行">民生银行</option>
                        <option value="浙商银行">浙商银行</option>
                    </select>
                </div> -->
                <!-- <div class=" bank_text layui-input-block ">
                    <input type="text" name="unit" lay-verify="required" autocomplete="off" placeholder="请填写您的预期贷款金额 （如，12万元）" class="layui-input">
                    <span style="font-size: 16px; position: absolute;right: 25px;top: 18px;color: #777777;">万元</span>
                </div> -->
                <div class=" bank_text layui-input-block ">
                    <span style=" width: 90px;">问题一：</span>
                    <div style="width: 550px;height: 60px;border: 1px solid #E8E8E8;border-radius: 15px;background: #F9F9F9;">
                        <span style="color: #777777;line-height: 60px;margin-left: 20px;margin-right: 240px; font-size: 16px;">您有房产吗？</span>
                        <input type="radio" class="property" name="property" value="有房产" title="有">
                        <input type="radio" class="property" name="property" value="无房产" title="无" checked>
                    </div>
                </div>
                <div class=" bank_text layui-input-block ">
                    <span style=" width: 90px;">问题二：</span>
                    <div style="width: 550px;height: 60px;border: 1px solid #E8E8E8;border-radius: 15px;background: #F9F9F9;">
                        <span style="color: #777777;line-height: 60px;margin-left: 20px;margin-right: 225px; font-size: 16px;">您有公积金吗？</span>
                        <input type="radio" class="security" name="security" value="有社保" title="有">
                        <input type="radio" class="security" name="security" value="无社保" title="无" checked>
                    </div>
                </div>
                <div class=" bank_text layui-input-block ">
                    <span style=" width: 90px;">问题三：</span>
                    <div style="width: 550px;height: 60px;border: 1px solid #E8E8E8;border-radius: 15px;background: #F9F9F9;">
                        <span style="color: #777777;line-height: 60px;margin-left: 20px;margin-right: 210px; font-size: 16px;">您有打卡工资吗？</span>
                        <input style="margin: 0px 10px 0 0;" type="radio" class="wage" name="wage" value="有打卡" title="有">
                        <input style="margin: 0px 10px 0 0;" type="radio" class="wage" name="wage" value="无打卡" title="无" checked>
                    </div>
                </div>

                <div style="padding: 0 160px;" class="bank_text layui-input-block">
                    <div style="background: #E83F44; line-height: 60px; font-size: 16px; border-radius: 10px; width: 300px;height: 60px;" class="layui-btn"
                        lay-submit="" lay-filter="demo1" onclick="tijiao()">立即提交</div>
                </div>
            </div>
        </form>
    </div>
    <!-- 底部 -->
    {include file="public/footer"}
</body>




<script src="__STATIC__/assets/arr_css/jquery-3.3.1.js"></script>
<script type="text/javascript" src="__STATIC__/assets/arr_css/jquery.SuperSlide2.js"></script>
<script src="__STATIC__/assets/arr_css/bootstrap.min.js"></script>
<script src="__STATIC__/assets/arr_css/head.js"></script>
<script src="__STATIC__/layui/layui.js"></script>
<!-- <script src="__STATIC__/assets/ferr/loan.js"></script> -->

<script>
    layui.use(['form', 'layedit', 'laydate'], function () {
        var form = layui.form,
            layer = layui.layer,
            layedit = layui.layedit,
            laydate = layui.laydate;

        form.on('select', function (data) {
            // console.log(data.elem); //得到select原始DOM对象
            console.log(data.value); //得到被选中的值
            // console.log(data.othis); //得到美化后的DOM对象
            // console.log(1);
            if (data.value == '华夏银行') {
                $(".bank_img img").attr('src', "__STATIC__/assets/images/logo_huaxiabank_onfocus.png");
            } else if (data.value == '民生银行') {
                $(".bank_img img").attr('src', "__STATIC__/assets/images/logo_minshengbank_onfocus.png");
            } else if (data.value == '浙商银行') {
                $(".bank_img img").attr('src', "__STATIC__/assets/images/logo_zheshangbank_onfocus.png");
            }
        });
        form.on('radio(filter)', function (data) {
            console.log(data.elem); //得到radio原始DOM对象
            console.log(data.value); //被点击的radio的value值
        });



    })




    function tijiao() {

        var phone = $('#phone').val();
        var name = $('#name').val();
        var bank_name = $('#bank_name').val()
        if (phone == '' || name == '' || bank_name == 0) {
            layer.msg('提交失败，表格未填写完整，请重新填写。', {
                icon: 2
            });
        } else {
            $.ajax({
                type: "POST",
                url: "{:url('Ferr/add')}",
                data: $('#formdata').serialize(), // 要提交的表单 
                success: function (data) {
                    console.log(data);
                    if (data == 1) {
                        //提示层
                        layer.msg('提交成功,请等待银行工作人员与您联系;', {
                            icon: 1
                        });
                    } else {
                        //提示层
                        layer.msg('提交失败,请重新填写;', {
                            icon: 2
                        });
                    }
                    // if (data =='success') {
                    //     // console.log(111);
                    //     layer.open({
                    //       type: 1,
                    //       shade: [0.5, '#000'],
                    //       title: false, //不显示标题
                    //       content: $('#qrcode'), //捕获的元素，注意：最好该指定的元素要存放在body最外层，否则可能被其它的相对元素所影响
                    //     });
                    // }else{
                    //     layer.confirm('生成二维码失败，请重新填写！', {
                    //       btn: ['确定'] //按钮
                    //     }
                    //     );
                    // }         
                }
            });
        }


    }
</script>

</html>